package com.iplay.实战java高并发程序设计.chapter3.c32;

import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author dangwu
 * @since 2021/11/1 2:42 下午
 */
public class DivTask implements Runnable{
    int a,b;
    public DivTask(int a,int b){
        this.a = a;
        this.b = b;
    }
    @Override
    public void run() {
        double re = a/b;
        System.out.println(re);
    }

    public static void main(String[] args) {
        ThreadPoolExecutor pools = new TraceThreadPoolExecutor(0,Integer.MAX_VALUE,0L, TimeUnit.SECONDS,new SynchronousQueue<>());
        for (int i = 0; i < 5; i++) {
            pools.submit(new DivTask(100,i));
        }
    }
}
